<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>(abstraction-rtos)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="logo.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">(abstraction-rtos)</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('group__group__abstraction__rtos__semaphore.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle"><div class="title">Semaphore</div></div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p >APIs for acquiring and working with Semaphores. </p>
<table class="memberdecls">
<tr class="memitem:gaf9b9e58ee67cbbe5fb53cedcaa01c318"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__abstraction__rtos__semaphore.html#gaf9b9e58ee67cbbe5fb53cedcaa01c318">cy_rtos_semaphore_init</a> (<a class="el" href="group__group__abstraction__rtos__port.html#ga97c7350dd41b5850577cc7667aee73d2">cy_semaphore_t</a> *semaphore, uint32_t maxcount, uint32_t initcount)</td></tr>
<tr class="memdesc:gaf9b9e58ee67cbbe5fb53cedcaa01c318"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a semaphore.  <a href="group__group__abstraction__rtos__semaphore.html#gaf9b9e58ee67cbbe5fb53cedcaa01c318">More...</a><br /></td></tr>
<tr class="separator:gaf9b9e58ee67cbbe5fb53cedcaa01c318"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7e8127c90dc05dc9f066dcd5a936768c"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__abstraction__rtos__semaphore.html#ga7e8127c90dc05dc9f066dcd5a936768c">cy_rtos_semaphore_get</a> (<a class="el" href="group__group__abstraction__rtos__port.html#ga97c7350dd41b5850577cc7667aee73d2">cy_semaphore_t</a> *semaphore, <a class="el" href="group__group__abstraction__rtos__port.html#ga141349b315f2266d5e0e8b8566eb608b">cy_time_t</a> timeout_ms)</td></tr>
<tr class="memdesc:ga7e8127c90dc05dc9f066dcd5a936768c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get/Acquire a semaphore.  <a href="group__group__abstraction__rtos__semaphore.html#ga7e8127c90dc05dc9f066dcd5a936768c">More...</a><br /></td></tr>
<tr class="separator:ga7e8127c90dc05dc9f066dcd5a936768c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3ede561d7a78c573ef37251f979afda2"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__abstraction__rtos__semaphore.html#ga3ede561d7a78c573ef37251f979afda2">cy_rtos_semaphore_set</a> (<a class="el" href="group__group__abstraction__rtos__port.html#ga97c7350dd41b5850577cc7667aee73d2">cy_semaphore_t</a> *semaphore)</td></tr>
<tr class="memdesc:ga3ede561d7a78c573ef37251f979afda2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set/Release a semaphore.  <a href="group__group__abstraction__rtos__semaphore.html#ga3ede561d7a78c573ef37251f979afda2">More...</a><br /></td></tr>
<tr class="separator:ga3ede561d7a78c573ef37251f979afda2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2a8cda29a29325cd934bac2e6194dc51"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__abstraction__rtos__semaphore.html#ga2a8cda29a29325cd934bac2e6194dc51">cy_rtos_semaphore_get_count</a> (<a class="el" href="group__group__abstraction__rtos__port.html#ga97c7350dd41b5850577cc7667aee73d2">cy_semaphore_t</a> *semaphore, size_t *count)</td></tr>
<tr class="memdesc:ga2a8cda29a29325cd934bac2e6194dc51"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the count of a semaphore.  <a href="group__group__abstraction__rtos__semaphore.html#ga2a8cda29a29325cd934bac2e6194dc51">More...</a><br /></td></tr>
<tr class="separator:ga2a8cda29a29325cd934bac2e6194dc51"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga63e4f7e66731826f51867c5f9ab2be68"><td class="memItemLeft" align="right" valign="top">cy_rslt_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__abstraction__rtos__semaphore.html#ga63e4f7e66731826f51867c5f9ab2be68">cy_rtos_semaphore_deinit</a> (<a class="el" href="group__group__abstraction__rtos__port.html#ga97c7350dd41b5850577cc7667aee73d2">cy_semaphore_t</a> *semaphore)</td></tr>
<tr class="memdesc:ga63e4f7e66731826f51867c5f9ab2be68"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deletes a semaphore.  <a href="group__group__abstraction__rtos__semaphore.html#ga63e4f7e66731826f51867c5f9ab2be68">More...</a><br /></td></tr>
<tr class="separator:ga63e4f7e66731826f51867c5f9ab2be68"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7055cc8d6884cd2b93e2011ef08d84e4"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__abstraction__rtos__semaphore.html#ga7055cc8d6884cd2b93e2011ef08d84e4">cy_rtos_init_semaphore</a>(semaphore,  maxcount,  initcount)&#160;&#160;&#160;    <a class="el" href="group__group__abstraction__rtos__semaphore.html#gaf9b9e58ee67cbbe5fb53cedcaa01c318">cy_rtos_semaphore_init</a>(semaphore, maxcount, initcount)</td></tr>
<tr class="memdesc:ga7055cc8d6884cd2b93e2011ef08d84e4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a semaphore.  <a href="group__group__abstraction__rtos__semaphore.html#ga7055cc8d6884cd2b93e2011ef08d84e4">More...</a><br /></td></tr>
<tr class="separator:ga7055cc8d6884cd2b93e2011ef08d84e4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga10f0ba0306c010872f8a38da2d1ccdd8"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__abstraction__rtos__semaphore.html#ga10f0ba0306c010872f8a38da2d1ccdd8">cy_rtos_get_semaphore</a>(semaphore,  timeout_ms,  in_isr)&#160;&#160;&#160;<a class="el" href="group__group__abstraction__rtos__semaphore.html#ga7e8127c90dc05dc9f066dcd5a936768c">cy_rtos_semaphore_get</a>(semaphore, timeout_ms)</td></tr>
<tr class="memdesc:ga10f0ba0306c010872f8a38da2d1ccdd8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get/Acquire a semaphore.  <a href="group__group__abstraction__rtos__semaphore.html#ga10f0ba0306c010872f8a38da2d1ccdd8">More...</a><br /></td></tr>
<tr class="separator:ga10f0ba0306c010872f8a38da2d1ccdd8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaec806e3bfa73d3a2cdfa556bd30b1a98"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__abstraction__rtos__semaphore.html#gaec806e3bfa73d3a2cdfa556bd30b1a98">cy_rtos_set_semaphore</a>(semaphore,  in_isr)&#160;&#160;&#160;<a class="el" href="group__group__abstraction__rtos__semaphore.html#ga3ede561d7a78c573ef37251f979afda2">cy_rtos_semaphore_set</a>(semaphore)</td></tr>
<tr class="memdesc:gaec806e3bfa73d3a2cdfa556bd30b1a98"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set/Release a semaphore.  <a href="group__group__abstraction__rtos__semaphore.html#gaec806e3bfa73d3a2cdfa556bd30b1a98">More...</a><br /></td></tr>
<tr class="separator:gaec806e3bfa73d3a2cdfa556bd30b1a98"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1c755e4ab340acaf409e3c2698dc6174"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__abstraction__rtos__semaphore.html#ga1c755e4ab340acaf409e3c2698dc6174">cy_rtos_get_count_semaphore</a>(semaphore,  count)&#160;&#160;&#160;<a class="el" href="group__group__abstraction__rtos__semaphore.html#ga2a8cda29a29325cd934bac2e6194dc51">cy_rtos_semaphore_get_count</a>(semaphore, count)</td></tr>
<tr class="memdesc:ga1c755e4ab340acaf409e3c2698dc6174"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the count of a semaphore.  <a href="group__group__abstraction__rtos__semaphore.html#ga1c755e4ab340acaf409e3c2698dc6174">More...</a><br /></td></tr>
<tr class="separator:ga1c755e4ab340acaf409e3c2698dc6174"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga023920ded27d2f3f44296995b2a31b47"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__abstraction__rtos__semaphore.html#ga023920ded27d2f3f44296995b2a31b47">cy_rtos_deinit_semaphore</a>(semaphore)&#160;&#160;&#160;<a class="el" href="group__group__abstraction__rtos__semaphore.html#ga63e4f7e66731826f51867c5f9ab2be68">cy_rtos_semaphore_deinit</a>(semaphore)</td></tr>
<tr class="memdesc:ga023920ded27d2f3f44296995b2a31b47"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deletes a semaphore.  <a href="group__group__abstraction__rtos__semaphore.html#ga023920ded27d2f3f44296995b2a31b47">More...</a><br /></td></tr>
<tr class="separator:ga023920ded27d2f3f44296995b2a31b47"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="ga7055cc8d6884cd2b93e2011ef08d84e4" name="ga7055cc8d6884cd2b93e2011ef08d84e4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7055cc8d6884cd2b93e2011ef08d84e4">&#9670;&nbsp;</a></span>cy_rtos_init_semaphore</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define cy_rtos_init_semaphore</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">semaphore, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">maxcount, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">initcount&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;    <a class="el" href="group__group__abstraction__rtos__semaphore.html#gaf9b9e58ee67cbbe5fb53cedcaa01c318">cy_rtos_semaphore_init</a>(semaphore, maxcount, initcount)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create a semaphore. </p>
<p >This is basically a counting semaphore. It can be used for synchronization between tasks and tasks and interrupts.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">semaphore</td><td>Pointer to the semaphore handle to be initialized </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">maxcount</td><td>The maximum count for this semaphore </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">initcount</td><td>The initial count for this semaphore</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the semaphore creation. [<a class="el" href="group__group__abstraction__rtos__common.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga516d500bef7d6e6291f08485d0bc003b">CY_RTOS_NO_MEMORY</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga89a0a071bd7a41b5d1f3edb969ee1647">CY_RTOS_GENERAL_ERROR</a>] </dd></dl>

</div>
</div>
<a id="ga10f0ba0306c010872f8a38da2d1ccdd8" name="ga10f0ba0306c010872f8a38da2d1ccdd8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga10f0ba0306c010872f8a38da2d1ccdd8">&#9670;&nbsp;</a></span>cy_rtos_get_semaphore</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define cy_rtos_get_semaphore</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">semaphore, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">timeout_ms, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">in_isr&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;<a class="el" href="group__group__abstraction__rtos__semaphore.html#ga7e8127c90dc05dc9f066dcd5a936768c">cy_rtos_semaphore_get</a>(semaphore, timeout_ms)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get/Acquire a semaphore. </p>
<p >If the semaphore count is zero, waits until the semaphore count is greater than zero. Once the semaphore count is greater than zero, this function decrements the count and return. It may also return if the timeout is exceeded.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">semaphore</td><td>Pointer to the semaphore handle </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">timeout_ms</td><td>Maximum number of milliseconds to wait while attempting to get the semaphore. Use the <a class="el" href="group__group__abstraction__rtos__common.html#gab31d8535128df9506a4220c2b1f41a60">CY_RTOS_NEVER_TIMEOUT</a> constant to wait forever. Must be zero if in_isr is true. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">in_isr</td><td>true if we are trying to get the semaphore from with an ISR </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of get semaphore operation [<a class="el" href="group__group__abstraction__rtos__common.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a>, <a class="el" href="group__group__abstraction__rtos__common.html#gafc6a1c6f563521d6c5555027d5d7bde8">CY_RTOS_TIMEOUT</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga516d500bef7d6e6291f08485d0bc003b">CY_RTOS_NO_MEMORY</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga89a0a071bd7a41b5d1f3edb969ee1647">CY_RTOS_GENERAL_ERROR</a>] </dd></dl>

</div>
</div>
<a id="gaec806e3bfa73d3a2cdfa556bd30b1a98" name="gaec806e3bfa73d3a2cdfa556bd30b1a98"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaec806e3bfa73d3a2cdfa556bd30b1a98">&#9670;&nbsp;</a></span>cy_rtos_set_semaphore</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define cy_rtos_set_semaphore</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">semaphore, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">in_isr&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;<a class="el" href="group__group__abstraction__rtos__semaphore.html#ga3ede561d7a78c573ef37251f979afda2">cy_rtos_semaphore_set</a>(semaphore)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set/Release a semaphore. </p>
<p >Increments the semaphore count, up to the maximum count for this semaphore.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">semaphore</td><td>Pointer to the semaphore handle </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">in_isr</td><td>Value of true indicates calling from interrupt context Value of false indicates calling from normal thread context </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of set semaphore operation [<a class="el" href="group__group__abstraction__rtos__common.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga516d500bef7d6e6291f08485d0bc003b">CY_RTOS_NO_MEMORY</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga89a0a071bd7a41b5d1f3edb969ee1647">CY_RTOS_GENERAL_ERROR</a>] </dd></dl>

</div>
</div>
<a id="ga1c755e4ab340acaf409e3c2698dc6174" name="ga1c755e4ab340acaf409e3c2698dc6174"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1c755e4ab340acaf409e3c2698dc6174">&#9670;&nbsp;</a></span>cy_rtos_get_count_semaphore</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define cy_rtos_get_count_semaphore</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">semaphore, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">count&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td>&#160;&#160;&#160;<a class="el" href="group__group__abstraction__rtos__semaphore.html#ga2a8cda29a29325cd934bac2e6194dc51">cy_rtos_semaphore_get_count</a>(semaphore, count)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get the count of a semaphore. </p>
<p >Gets the number of available tokens on the semaphore.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">semaphore</td><td>Pointer to the semaphore handle </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">count</td><td>Pointer to the return count </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of get semaphore count operation [<a class="el" href="group__group__abstraction__rtos__common.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga89a0a071bd7a41b5d1f3edb969ee1647">CY_RTOS_GENERAL_ERROR</a>] </dd></dl>

</div>
</div>
<a id="ga023920ded27d2f3f44296995b2a31b47" name="ga023920ded27d2f3f44296995b2a31b47"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga023920ded27d2f3f44296995b2a31b47">&#9670;&nbsp;</a></span>cy_rtos_deinit_semaphore</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define cy_rtos_deinit_semaphore</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">semaphore</td><td>)</td>
          <td>&#160;&#160;&#160;<a class="el" href="group__group__abstraction__rtos__semaphore.html#ga63e4f7e66731826f51867c5f9ab2be68">cy_rtos_semaphore_deinit</a>(semaphore)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Deletes a semaphore. </p>
<p >This function frees the resources associated with a semaphore.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">semaphore</td><td>Pointer to the semaphore handle</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of semaphore deletion [<a class="el" href="group__group__abstraction__rtos__common.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga516d500bef7d6e6291f08485d0bc003b">CY_RTOS_NO_MEMORY</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga89a0a071bd7a41b5d1f3edb969ee1647">CY_RTOS_GENERAL_ERROR</a>] </dd></dl>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="gaf9b9e58ee67cbbe5fb53cedcaa01c318" name="gaf9b9e58ee67cbbe5fb53cedcaa01c318"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf9b9e58ee67cbbe5fb53cedcaa01c318">&#9670;&nbsp;</a></span>cy_rtos_semaphore_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_rtos_semaphore_init </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__abstraction__rtos__port.html#ga97c7350dd41b5850577cc7667aee73d2">cy_semaphore_t</a> *&#160;</td>
          <td class="paramname"><em>semaphore</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>maxcount</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>initcount</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create a semaphore. </p>
<p >This is basically a counting semaphore. It can be used for synchronization between tasks and tasks and interrupts.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in,out]</td><td class="paramname">semaphore</td><td>Pointer to the semaphore handle to be initialized </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">maxcount</td><td>The maximum count for this semaphore </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">initcount</td><td>The initial count for this semaphore</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of the semaphore creation. [<a class="el" href="group__group__abstraction__rtos__common.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga516d500bef7d6e6291f08485d0bc003b">CY_RTOS_NO_MEMORY</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga89a0a071bd7a41b5d1f3edb969ee1647">CY_RTOS_GENERAL_ERROR</a>] </dd></dl>

</div>
</div>
<a id="ga7e8127c90dc05dc9f066dcd5a936768c" name="ga7e8127c90dc05dc9f066dcd5a936768c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga7e8127c90dc05dc9f066dcd5a936768c">&#9670;&nbsp;</a></span>cy_rtos_semaphore_get()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_rtos_semaphore_get </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__abstraction__rtos__port.html#ga97c7350dd41b5850577cc7667aee73d2">cy_semaphore_t</a> *&#160;</td>
          <td class="paramname"><em>semaphore</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__group__abstraction__rtos__port.html#ga141349b315f2266d5e0e8b8566eb608b">cy_time_t</a>&#160;</td>
          <td class="paramname"><em>timeout_ms</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get/Acquire a semaphore. </p>
<p >If the semaphore count is zero, waits until the semaphore count is greater than zero. Once the semaphore count is greater than zero, this function decrements the count and return. It may also return if the timeout is exceeded.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">semaphore</td><td>Pointer to the semaphore handle </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">timeout_ms</td><td>Maximum number of milliseconds to wait while attempting to get the semaphore. Use the <a class="el" href="group__group__abstraction__rtos__common.html#gab31d8535128df9506a4220c2b1f41a60">CY_RTOS_NEVER_TIMEOUT</a> constant to wait forever. Must be zero if in_isr is true. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of get semaphore operation [<a class="el" href="group__group__abstraction__rtos__common.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a>, <a class="el" href="group__group__abstraction__rtos__common.html#gafc6a1c6f563521d6c5555027d5d7bde8">CY_RTOS_TIMEOUT</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga516d500bef7d6e6291f08485d0bc003b">CY_RTOS_NO_MEMORY</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga89a0a071bd7a41b5d1f3edb969ee1647">CY_RTOS_GENERAL_ERROR</a>] </dd></dl>

</div>
</div>
<a id="ga3ede561d7a78c573ef37251f979afda2" name="ga3ede561d7a78c573ef37251f979afda2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga3ede561d7a78c573ef37251f979afda2">&#9670;&nbsp;</a></span>cy_rtos_semaphore_set()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_rtos_semaphore_set </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__abstraction__rtos__port.html#ga97c7350dd41b5850577cc7667aee73d2">cy_semaphore_t</a> *&#160;</td>
          <td class="paramname"><em>semaphore</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set/Release a semaphore. </p>
<p >Increments the semaphore count, up to the maximum count for this semaphore.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">semaphore</td><td>Pointer to the semaphore handle Value of false indicates calling from normal thread context </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of set semaphore operation [<a class="el" href="group__group__abstraction__rtos__common.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga516d500bef7d6e6291f08485d0bc003b">CY_RTOS_NO_MEMORY</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga89a0a071bd7a41b5d1f3edb969ee1647">CY_RTOS_GENERAL_ERROR</a>] </dd></dl>

</div>
</div>
<a id="ga2a8cda29a29325cd934bac2e6194dc51" name="ga2a8cda29a29325cd934bac2e6194dc51"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2a8cda29a29325cd934bac2e6194dc51">&#9670;&nbsp;</a></span>cy_rtos_semaphore_get_count()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_rtos_semaphore_get_count </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__abstraction__rtos__port.html#ga97c7350dd41b5850577cc7667aee73d2">cy_semaphore_t</a> *&#160;</td>
          <td class="paramname"><em>semaphore</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t *&#160;</td>
          <td class="paramname"><em>count</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get the count of a semaphore. </p>
<p >Gets the number of available tokens on the semaphore.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">semaphore</td><td>Pointer to the semaphore handle </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">count</td><td>Pointer to the return count </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of get semaphore count operation [<a class="el" href="group__group__abstraction__rtos__common.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga89a0a071bd7a41b5d1f3edb969ee1647">CY_RTOS_GENERAL_ERROR</a>] </dd></dl>

</div>
</div>
<a id="ga63e4f7e66731826f51867c5f9ab2be68" name="ga63e4f7e66731826f51867c5f9ab2be68"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga63e4f7e66731826f51867c5f9ab2be68">&#9670;&nbsp;</a></span>cy_rtos_semaphore_deinit()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">cy_rslt_t cy_rtos_semaphore_deinit </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__group__abstraction__rtos__port.html#ga97c7350dd41b5850577cc7667aee73d2">cy_semaphore_t</a> *&#160;</td>
          <td class="paramname"><em>semaphore</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Deletes a semaphore. </p>
<p >This function frees the resources associated with a semaphore.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">semaphore</td><td>Pointer to the semaphore handle</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The status of semaphore deletion [<a class="el" href="group__group__abstraction__rtos__common.html#gaf58fac450d9fff4472f03ad68f6e546e">CY_RSLT_SUCCESS</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga516d500bef7d6e6291f08485d0bc003b">CY_RTOS_NO_MEMORY</a>, <a class="el" href="group__group__abstraction__rtos__common.html#ga89a0a071bd7a41b5d1f3edb969ee1647">CY_RTOS_GENERAL_ERROR</a>] </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>(abstraction-rtos)</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
